﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.BLL;
using YouHP.Utility;
using YouHP.Model;
using System.Text.RegularExpressions;
using System.Web;

namespace YouHP.Pages.Profile
{
    public class LogList : YouHP.Pages.Profile.ProfileBasePage
    {
        public override void InitPage()
        {
            base.InitPage();
            this.PageKey = PageKeys.Profile_LogList;
        }

        protected override void ShowPage()
        {
            base.ShowPage();
            if (this.ErrorCount > 0) return;

            HandleCommon();
            if (IsPost) HandlePost();
            else HandleGet();
        }

        protected List<LogTopicInfo> LogDataList;
        protected int PageIndex;
        protected int DataCount;
        protected int PageCount;
        protected string PagingString = "";

        protected void HandleCommon()
        {
            this.SetTitle("日志列表");
            this.AddLocation("日志列表", "");
        }

        protected void HandlePost()
        {
        }

        protected void HandleGet()
        {
            PageIndex = RequestTools.GetQueryInt("page", 1);

            LogDataList = LogTopicBLL.Instance.GetLogTopicList(10, PageIndex, ProfileData.Id,out DataCount);
            PageCount = Utils.GetPageCount(DataCount, 10);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            PagingString = this.GetPagingString(
                PageIndex,
                PageCount,
                "/Profile/LogList.aspx" + query, "page");
        }
    }
}